package br.unicamp.ic.inf300.arena.action;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import net.sourceforge.stripes.localization.DefaultLocalePicker;

public class ArenaLocalePicker extends DefaultLocalePicker {
	
	@Override
	public Locale pickLocale(HttpServletRequest request) {
		Locale locale = (Locale) request.getSession().getAttribute("locale");
		if (locale == null) {
			locale = new Locale("pt", "BR");
		}
		return locale;
	}
	
	@Override
	public String pickCharacterEncoding(HttpServletRequest request, Locale locale) {
		if(pickLocale(request).getLanguage() == "pt") {
			return "ISO-8859-1";
		}
		return "UTF-8";
	}
}